home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Effect library / Demo ƒ / Reversed wipes ƒ / Ripple wipe reversed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-11  |  2.6 KB  |  78 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Ripple wipe reversed.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8.  
  9. MSG Demo -- graphic effects demonstration program
  10. Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define CorrectTime 1
  32. #define theWindowWidth (boundsRect.right-boundsRect.left)
  33. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  34.  
  35. pascal short RippleWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  36.  
  37. /* Like Caste wipe down, except the screen is split into 6 sections, and the
  38.    caste wipe is performed in each section -- hence the ripple effect. */
  39.    
  40. pascal short RippleWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  41. {
  42.     int                bigy, littley, barpos;
  43.     Rect            src, dest;
  44.     int                BigRippleSize;
  45.     int                gap;
  46.     RgnHandle        boundsRgn;
  47.     
  48.     BigRippleSize=theWindowHeight/6;    /* used to be 52 */
  49.     gap=BigRippleSize/6;                /* used to be 8 */
  50.     boundsRgn=NewRgn();
  51.     SetRectRgn(boundsRgn, boundsRect.left, boundsRect.top, boundsRect.right, boundsRect.bottom);
  52.     src.left = dest.left = boundsRect.left;
  53.     src.right = dest.right = boundsRect.right;
  54.     
  55.     for(bigy = 0; bigy < theWindowHeight; bigy += BigRippleSize)
  56.     {
  57.         for(littley = bigy; littley < bigy + BigRippleSize; littley += gap)
  58.         {
  59.             for(barpos = bigy; barpos + gap < bigy + BigRippleSize; barpos += gap);
  60.             for(; barpos >= littley; barpos -= gap)
  61.             {
  62.                 StartTiming();
  63.                 src.top = boundsRect.bottom - littley - gap;
  64.                 src.bottom = boundsRect.bottom - littley;
  65.                 dest.top = boundsRect.bottom - barpos - gap;
  66.                 dest.bottom = dest.top + gap;
  67.                 CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  68.                         &src, &dest, 0, boundsRgn);
  69.                 TimeCorrection(CorrectTime);
  70.             }
  71.         }
  72.     }
  73.     
  74.     DisposeRgn(boundsRgn);
  75.     
  76.     return 0;
  77. }
  78.